package cn.tedu.backend.portal.mapper;

import cn.tedu.backend.portal.model.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//@Repository
@Mapper
public interface UserMapper extends BaseMapper<User> {
    //查询所有
    @Select("select * from user")
    List<User> selectAll();

    //删除信息
    @Delete("delete from user where user_id=#{userId}")
    int deleteByUserId(String userId);

    //查找管理员昵称
    @Select("select nicknames from user where user_id=#{userId}")
    String selectNicknameByUserId(String userId);

    //查找管理员昵称
//    @Select("select nicknames from user where user_id='654321@qq.com'")
//    String selectNicknameByUserId();

    //统计用户总人数
    @Select("select count(*) from user")
    int selectCount();

    //统计VIP用户总人数
    @Select("select count(*) from user where vip='是'")
    int selectVipCount();

    //统计普通用户总人数
    @Select("select count(*) from user where vip!='是'")
    int selectNormalCount();
}